﻿@{
    Layout = null;
}

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>我的金币</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <script src="@Url.Content("~/js/jquery.js")"></script>
    <script src="~/js/jweixin-1.0.0.js"></script>
        @*关于微信端的配置*@
    <script>
        var AppId = "@ViewBag.appid";
        var AppSercret = "@ViewBag.appsecret";
        var timestamp = "@ViewBag.timestamp";
        var nonceStr = "@ViewBag.nonceStr";
        var signature = "@ViewBag.signature";
    </script>

    <script src="@Url.Content("~/js/DailyTaskCommon.js")?a=@(new Random().Next())"></script>
    <link href="@Url.Content("~/css/DailyTask/basic.css")?a=@(new Random().Next())" rel="stylesheet" />
    <script>
        (function (doc, win) { var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', recalc = function () { var clientWidth = docEl.clientWidth < 768 ? docEl.clientWidth : 768; if (!clientWidth) return; docEl.style.fontSize = 16 * (clientWidth / 320) + 'px'; }; recalc(); if (!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc, false); })(document, window);
    </script>
</head>
<body>
    <div class="box">
        <header class="header" id="header">
            <div class="header_exchanger">
                <h3>@ViewBag.sumGold</h3>
                <p>我的金币</p>
                <p>
                    <a href="@Url.Action("GamePage", "DailyTask")?openid=@ViewBag.openid">
                        <img src="@Url.Content("~/images/DailyTask/exchanger_img.jpg")" /></a>
                </p>
            </div>
        </header>
        <div class="qh_record" id="qh_record">
            <ul id="ulList">
            </ul>
        </div>
    </div>
</body>
<script type="text/javascript">
    var height = document.documentElement.clientHeight;
    var header = document.getElementById("header").offsetHeight;
    var qh_record = document.getElementById("qh_record");
    qh_record.style.minHeight = height - header + 'px';
</script>

<script type="text/javascript">
    var currpage = 1;
    var totalPage = 1;

    function getData() {
        $.ajax({
            url: "@Url.Action("GetDailyTaskDataByPage", "DailyTask")",
            type: 'post',
            data: { page: currpage, openid: '@ViewBag.openid' },
            dataType: 'json',
            success: function (data) {
                totalPage = data.totalPage;
                var lst = data.list;
                var ulList = $("#ulList");
                for (var i = 0; i < lst.length; i++) {
                    var li = $("<li><span></span><p>" + lst[i] + "</p></li>");
                    ulList.append(li);
                }
            }
        });
    }

    $(function () {
        $(window).scroll(function () {  //滚动条的事件
            var scrollTop = $(this).scrollTop();
            var scrollHeight = $(document).height();
            var windowHeight = $(this).height();
            if (scrollHeight - (scrollTop + windowHeight) < 10) {  //说明已经快滚到最底部了
                if (currpage < totalPage) {
                    currpage++;
                    getData();
                }
            }

        });

        getData();
    });

</script>
</html>
